package com.jet.goods.gate;

import com.jet.core.result.ResultJson;
import com.jet.goods.domain.vo.SpuDetailVo;
import com.jet.goods.service.IGoodsSpuService;
import org.springframework.web.bind.annotation.*;

/**
 * @author dcl
 * @date 2023-02-24 13:09:30
 */
@RestController
@RequestMapping("/gate/goods")
public class GateGoodsController {

    private final IGoodsSpuService goodsSpuService;

    public GateGoodsController(IGoodsSpuService goodsSpuService) {
        this.goodsSpuService = goodsSpuService;
    }

    @GetMapping("/barcode/{barcode}")
    public ResultJson<SpuDetailVo> findByBarcode(@RequestHeader long merchantNo,
                                                 @RequestHeader long storeNo,
                                                 @RequestHeader String accountId,
                                                 @PathVariable("barcode") String barcode) {
        return ResultJson.ok(goodsSpuService.findDetailBySpuNo(merchantNo, barcode));
    }
}
